﻿using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace Lapkin.Helpers
{
    public static class HashHelper
    {
        public static string Salt = "bananasalt";

        public static string GetShaHash(this string text)
        {
            var unicodeEncoding = new UnicodeEncoding();
            byte[] message = unicodeEncoding.GetBytes(Salt + text + Salt + Salt);
            var hashString = new SHA512Managed();

            byte[] hashValue = hashString.ComputeHash(message);
            return hashValue.Aggregate("", (currentString, currentByte) => currentString + String.Format("{0:x2}", currentByte));
        }
    }
}